# -*- coding: utf-8 -*-
"""
Created on Thu Oct 18 10:14:16 2018

@author: Shinelon
"""

import time
from PIL import ImageGrab

beginTime = time.strftime("%Y-%m-%d-%H-%M", time.localtime())

m = int(input("输入想抓屏时间："))
n = 1
while n < m:
    time.sleep(0.5)
    im = ImageGrab.grab()
    local = ("{}-{}.jpg".format(beginTime, n))
    im.save(local, 'jpeg')
    n = n + 1
    print(".", end="")

print("抓屏结束")    